<script setup>
import LoginForm from '@/components/login/LoginForm.vue'
import LoadingBox from '@/utils/LoadingBox'
import { sha256 } from 'js-sha256'
import { useUserStore } from '@/stores/user'
import { useRouter, useRoute } from "vue-router"
import { login } from '@/api/account.js'
const router = useRouter()
const userStore = useUserStore()

function submit(data){
    
    var da = { ...data };
    da.password = sha256(data.password);
    login(da, res => {
        // console.log(res)
        userStore.loginSucceeded(res);
    });

    // router.push({ path: "/home" })
}


</script>

<template>
 <div class="login__page">

    <div class="form_padding">
        <div class="form">
            <h1> Wchime后台管理 </h1>
            <LoginForm
            @submit="submit"
            ></LoginForm>
        </div>
    </div>
    
    
</div>
</template>

<style scoped lang="scss">
.login__page{
    min-width: 100%;
    min-height: 100%;
    background: url('./../assets/image/login_back.png');
    background-size: cover; /* 背景图片覆盖整个元素 */
  background-repeat: no-repeat; /* 背景图片不重复 */
  background-position: center; /* 背景图片居中 */
    width: max(100vw, 900px);
    height: max(100vh, 700px);
    overflow: hidden;
    position: relative;
    .language__box{
        position: absolute;
        // width: 100%;
        // border: 1px solid red;
        font-size: 20px;
        color: #000;
        padding: 5px;
        right: 15px;
        top: 5px;
        cursor: pointer;
    }
    .language__box:hover{
        color: var(--wchime-color-highlight);
    }
    .form_padding{
        // padding-top: 100px;
        position: relative;
        .form{
            position: absolute;
            top: 130px;
            right: 180px;
            h1{
                font-size: 30px;
            }
            background-color: white;;
            width: 400px;
            padding: 40px 30px;
            margin: auto;
            box-shadow: 5px 5px rgba(0, 0, 0, 0.1);

            }
    }
    
}

</style>
